package com.mrtan.service.impl;

import com.mrtan.bean.Model;
import com.mrtan.bean.Product;
import com.mrtan.bean.Supplier;
import com.mrtan.bean.SupplierProduct;
import com.mrtan.mapper.ModelMapper;
import com.mrtan.mapper.ProductMapper;
import com.mrtan.mapper.SupplierMapper;
import com.mrtan.mapper.SupplierProductMapper;
import com.mrtan.service.ProcureService;
import com.mrtan.vo.ProductWhereVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 韦威
 * @version 2023.1.3
 * @Date 2023/12/4 14:25
 */
@Service
public class ProcureServiceImpl implements ProcureService {

//    @Resource
//    private SupplierMapper supplierMapper;
//    @Resource
//    private ProductMapper productMapper;
//    @Resource
//    private SupplierProductMapper supplierProductMapper;
//    @Resource
//    private ModelMapper modelMapper;
//
//    @Override
//    public List<Product> findAll(ProductWhereVO productWhereVO) {
//        List<Product> list = productMapper.selectAllByProductVO(productWhereVO);
//        return list;
//    }
//    @Override
//    public List<Supplier> findAllSupplier(ProductWhereVO productWhereVO) {
//        List<Supplier> list = supplierMapper.selectAllByProductVO(productWhereVO);
//        return list;
//    }
//
//    @Override
//    public List<Map<String,String>> findProductBySupplierName(String supplierName) {
//        List<Map<String,String>> list = new ArrayList<>();
//        Supplier supplier = supplierMapper.selectByName(supplierName);
//        if (supplier != null){
//            List<SupplierProduct> supplierProductList = supplierProductMapper.selectBySupplierId(supplier.getId());
//            for (SupplierProduct supplierProduct : supplierProductList) {
//                Product product = productMapper.selectByPrimaryKey(supplierProduct.getProductId());
//                Model model = modelMapper.selectByPrimaryKey(product.getModel());
//                Map<String,String> map = new HashMap<>();
//                map.put("name",product.getName());
//                map.put("brand",product.getBrand());
//                map.put("model",model.getInfo());
//                map.put("supply_price", String.valueOf(supplierProduct.getSupplyPrice()));
//                map.put("suggested_price", String.valueOf(supplierProduct.getSuggestedPrice()));
//                map.put("status", String.valueOf(supplierProduct.getStatus()));
//                map.put("quantity", String.valueOf(supplierProduct.getQuantity()));
//                list.add(map);
//            }
//            return list;
//        }
//        return null;
//    }


}
